package cn.edu.scau.cmi.zhonghaozheng.composite.safe;

import java.util.ArrayList;
import java.util.List;

public class Organization extends OrganizationComponent{
	private Organization parent = null;
	private String name = "";
	private List<OrganizationComponent> children = new ArrayList<OrganizationComponent>();
	public Organization() {
		
	}
	public Organization(String name) {
		this.name = name;
	}
	@Override
	public String doSomething() {
		return "Organization["+name+"]";
	}

	public OrganizationComponent addChildren(OrganizationComponent child) {
		children.add(child);
		return this;
	}
	
	public OrganizationComponent removeChildren(OrganizationComponent child) {
		children.remove(child);
		return this;
	}
	
	public void setChildren(List<OrganizationComponent> children) {
		this.children = children;
	}
	
	public List<OrganizationComponent> getChildren(){
		return this.children;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return this.name;
	}
	@Override
	public int getType() {
		return ORGANIZATION_TYPE;
	}
	@Override
	public Organization getParent() {
		return parent;
	}
	public void setParent(Organization parent) {
		this.parent = parent;
	}
}
